package main

import (
	"Head-first-go/chapter05/example1/datafile"
	"fmt"
	"log"
)

func main() {
	lines, err := datafile.GetStrings("votes.txt")
	if err != nil {
		log.Fatal(err)
	}
	counts := make(map[string]int)
	for _, line := range lines {
		if line == "" {
			continue
		}
		counts[line]++
	}

	// fmt.Println(counts)
	for k, v := range counts {
		fmt.Printf("Name: %s, count: %d\n", k, v)
	}

}
